﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Ataric.Themester.Parser;

namespace Ataric.Themester.Test.App
{
    class Program
    {
        static void Main(string[] args)
        {
            string css="table.ms-custom {"
                  + "     background:#abcfff url('img_tree.png') no-repeat right top;"
	              + "     border-top: 2px dotted #707984;"
	              + "     border-bottom: 1px solid;"
                  + "     border-bottom-color: #707984;"
                  + "     color: #707984;"
                  + "     font: #707984 bolder 10px small-caps new italic Times New Roman, Times, serif; "
                  + "     list-style: circle url('sqpurple.gif') inside;"
                  + "     margin:100px 50px 15px 25px;"
                  +"      outline: red thin dotted;"
                  +"}";

            Console.WriteLine(css);
            Console.WriteLine("-------------------------------------------------------------------");
            CSSParser parser = new CSSParser();
            CSSDocument doc = parser.ParseText(css);
            RuleSet rule = doc.RuleSets[0];
            rule.SplitOut();
            Console.WriteLine(rule.ToString());

            Console.WriteLine("-------------------------------------------------------------------");
            rule.Normalize();
            Console.WriteLine(rule.ToString());

            Console.WriteLine("-------------------------------------------------------------------");
            StreamReader reader = File.OpenText(@"C:\Users\truongdnnguyen\Desktop\Projects\CSS Parser\Source\Themester\Themester\App_Data\sample.css");
            
            CSSDocument mydoc = parser.ParseText(reader.ReadToEnd());
            reader.Close();
            CSSDocument final = mydoc.SingleAll();
            Console.WriteLine(final.ToString());

        }
    }
}
